<?php
// some house cleaning:
//purge old uploads

$dirToList = './uploads/';
deleteDirFiles($dirToList);

function deleteDirFiles ($dir) {

if ($handle = opendir($dir)) {
		while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            //echo "$file\n";
            unlink($dir.'/'.$file);
        }        
              }
    
    closedir($handle);
}
} // end of dirListing


echo'<html>
<head>
<title> CVS Upload for QR Code Creation 
</title>
<!--
<script src="js/libs/jquery-1.5.2.min.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" src="http://view.jquery.com/trunk/plugins/validate/lib/jquery.delegate.js"></script>
<script type="text/javascript" src="http://view.jquery.com/trunk/plugins/validate/jquery.validate.js"></script>
-->
<script type="text/javascript">
<!--
jQuery.validator.setDefaults({
	debug: true,
	success: "valid"
});
</script>
<script type="text/javascript">
$(document).ready(function(){
 $("#csvUpload").validate({
  rules: {
    uploadedfile: {
      required: true,
      accept: "csv"
    }
  }
 });
});
-->
</script>

<style>
label.error {
		background: url(\'http://view.jquery.com/trunk/plugins/validate/demo/images/unchecked.gif\') no-repeat;
		padding-left: 16px;
		margin-left: .3em;
	}
label.valid {
		background: url(\'view.jquery.com/view/trunk/plugins/validate/demo/images/checked.gif\') no-repeat;
		display: block;
		width: 16px;
		height: 16px;
	}
	</style>
</head><body>';
echo '<h4>CVS upload for QR Code generation</h4>
<p>Use this form to upload a properly formatted CVS document to the QR Code Generator<p>
<form id="csvUpload" enctype="multipart/form-data" action="qrCodeGenerator.php" method="POST">
<input  type="hidden" name="MAX_FILE_SIZE" value="100000" />
<label for="uploadedfile">Choose a file to upload:</label> <input class="uploadedfile" id="uploadedfile" name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>';
echo'<p><strong>Here is a Generic sample format for the CVS document:</strong><br>FirstName;LastName;Title;Phone;Email;Street;City;State;Zip;URL<br></p>
<p><strong>and here is one with some real data:</strong><br>
Matt;Gantner;Project Manager;123-456-7890;matt.gantner@wslife.com;123 anystreet;Cincinnati;OH;12345;www.wslife.com</p> <p><strong>Note:</strong><br>
<ul>
<li>Each entry needs to be on one line</li>
<li>use the \';\' (semicolon) as the field separator</li>
<li>do not use quotes anywhere</li>
<li>This utility requires internet connectivity to work properly</li>
</ul>';
echo '</body></html>';

?>